//
//  NetworkTools.swift
//  CXCWeibo
//
//  Created by cxc on 15/6/25.
//  Copyright © 2015年 china. All rights reserved.
//

import UIKit
import AFNetworking

class NetworkTools: AFHTTPSessionManager{
    /// 懒加载 单例
    private static let instance:NetworkTools = {
        let urlString = "https://api.weibo.com/"
        let baseURL = NSURL(string: urlString)
        let tools = NetworkTools(baseURL: baseURL)
        
        /**
        *  设置相应的默认反序列化格式
        */
        tools.responseSerializer.acceptableContentTypes = NSSet(objects: "application/json", "text/json", "text/javascript", "text/plain") as! Set<String>
        
        return tools
    }()
    
    /**
    全局访问函数
    
    :returns: NetworkTools
    */
    class func sharedNetworkTools() ->NetworkTools {
        return instance
    }
}
